#ifndef ANIMATIONINFO_H
#define ANIMATIONINFO_H

#include "EngineApi.h"
#include "boost\shared_ptr.hpp"

#include <vector>

struct ENGINE_API Frame
{
   unsigned int x;
   unsigned int y;
   unsigned int width;
   unsigned int height;
};

class ENGINE_API AnimationInfo
{
public:
   typedef boost::shared_ptr<AnimationInfo> AnimationInfoPtr;

   void addFrame(unsigned int x, unsigned int y, unsigned int width, unsigned int height);

   void setLength(float lenght)
   {
      m_length = lenght;
      m_timePerFrame = m_length / m_frames.size();
   }
   
   float getLength(){ return m_length; }

   void setSpeed(float speed){ m_speed = speed; }
   float getSpeed(){ return m_speed; };

   void setLoopable(bool loopable){ m_loopable = loopable; }
   bool getLoopable(){ return m_loopable; }

   float getTimePerFrame(){ return m_timePerFrame; }

   size_t getFrameCount(){ return m_frames.size(); }

   const Frame& getFrame(unsigned int frameNumber){ return m_frames[frameNumber]; }

private:
   float m_length;
   float m_speed;
   float m_timePerFrame;

   std::vector<Frame> m_frames;

   bool m_loopable;
};

#endif//ANIMATIONINFO_H